/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package nextel.visita.bean;

import java.io.IOException;
import org.kxml2.io.KXmlParser;
import org.kxml2.io.KXmlSerializer;
import pe.com.nextel.rms.DataInputStreamX;
import pe.com.nextel.rms.DataOutputStreamX;
import pe.com.nextel.rms.PersistenteX;
import pe.com.nextel.util.List;
import pe.com.nextel.util.StringUtils;

/**
 *
 * @author jcampana
 */
public class FotoBean extends PersistenteX {
    
//    public int codigoNextel; 
    public String idUsuario; 
    public String fecha;
    public String codigoActividad;
    public byte[] data;
    
    //public String codVisita = "";
    
    public void persistir(DataOutputStreamX dataOutput, List vector) throws IOException {
        
//        dataOutput.writeInt(codigoNextel); 
        dataOutput.writeString(StringUtils.stringNullToBlank(codigoActividad)); 
        dataOutput.writeString(StringUtils.stringNullToBlank(idUsuario)); 
        dataOutput.writeString(StringUtils.stringNullToBlank(fecha));
        dataOutput.writeInt(data.length);
        if(data.length > 0){
            dataOutput.write(data);
        }
    }
    
    public List recuperar(DataInputStreamX dataInput) throws IOException {
        
//        codigoNextel = (dataInput.readInt()); 
        codigoActividad = (dataInput.readString()); 
        idUsuario = (dataInput.readString()); 
        fecha= (dataInput.readString());
        
        int len = dataInput.readInt();
        
        if (len > 0) {
            data = (new byte[len]);
            dataInput.read(data);
        }
        
        return null;
    }
    
    public void writeXMLObject(KXmlSerializer arg0) throws IOException {
    }
    
    public void readXMLObject(KXmlParser arg0) throws IOException {
    }
    
    public void clear() {
        data = null;
    }
    
    
}
